<!-- 各种规则 -->
<template>
	<view class="rules">
		<mp-html :content="innerHtml" @error="errorFun" />
		<view class="nodata" v-if="!innerHtml">
			<image class="empty_img" :src="IMGLink+'/my/empty.png'" mode="widthFix"></image>
			<view>没有你想要的内容</view>
		</view>
	</view>
</template>

<script>
	import {
		rules
	} from '@/api/my/my.js';
	export default {
		name: "ruledetail",
		props: {
			type: {
				type: String,
				value: ""
			}
		},
		data() {
			return {
				innerHtml: "",
				IMGLink: this.IMGLink,
			}
		},
		computed: {
			curtype(){
				return this.type;
			}
		},
		mounted() {
			this.getDetail();
		},
		onLoad() {
			
		},
		methods: {
			// 获取富文本
			getDetail() {
				uni.showLoading({
					title: `加载中`
				});
				rules('agreementDetail', {
					type: this.curtype
				}).then(res => {
					let datas = res.data;
					this.innerHtml = datas.content;
					uni.hideLoading();
				}).catch(error => {
					uni.hideLoading();
				})
			},
			
			errorFun(e) {
				uni.showModal({
					content: '显示出错，请稍后再试',
					showCancel: true,
					success: (res) => {
						if (res.confirm) {
							uni.navigateBack()
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.rules{
		padding: 20rpx 30rpx;
		
		.nodata {
			text-align: center;
			color: #7D7D7D;
			font-size: 24rpx;
			margin-top: 50%;
		
			.empty_img {
				width: 468rpx;
			}
		}
	}
</style>
